package org.example.config;


import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * mp分页查询插件
 *
 */
@Configuration
public class MybatisPlusConfig {


    @Bean//交给pring管理
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        //构造拦截器
        MybatisPlusInterceptor mybatisPlusInterceptor =new MybatisPlusInterceptor();

        //加入分页插件
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());

        //返回拦截器
        return mybatisPlusInterceptor;

    }
}
